package com.wealth.scsj.b_app.presenter;

import android.util.Log;

import com.orhanobut.logger.Logger;
import com.wealth.scsj.b_app.base.AlterPayPwdBase;
import com.wealth.scsj.b_app.bean.BaseBean;
import com.wealth.scsj.b_app.model.AlterPayPwdModel;

import dkmvp.mvp.BasePresenter;
import dkmvp.net.ResponseCallback;
import okhttp3.RequestBody;

/**
 * 修改登录密码presenter
 */

public class AlterPayPwdPresenter extends BasePresenter implements AlterPayPwdBase.IPresenter {

    private AlterPayPwdBase.IModel mModel;
    private AlterPayPwdBase.IView mView;

    public AlterPayPwdPresenter(AlterPayPwdBase.IView view) {
        mView = view;
        mModel = new AlterPayPwdModel();
    }


    @Override
    public void deliverData(RequestBody requestBody) {
        addSubscription(mModel.getData(requestBody, new ResponseCallback<BaseBean>() {
            @Override
            public void onSuccess(BaseBean result) {
                if (result.getStatusCode() == 200) {
                    mView.showSuccessMsg("支付密码修改成功", result);
                    Logger.d("支付密码修改成功" + result.toString());
                } else {
                    mView.showErrorMsg(result.getMsg());
                }
            }

            @Override
            public void onFaild(String msg) {
                mView.showErrorMsg(msg);
                Log.e("支付登录密码onFaild", msg + "");
            }
        }));
    }

}
